package com.jkozniewski.util.util3d
{
	public class Util3D{
		
		public static const X_AXIS:uint = 2;
		public static const Y_AXIS:uint = 4;
		public static const Z_AXIS:uint = 8;
		
		public static const RAD_TO_DEG:Number = 180/Math.PI;
		
		public static function getAnglesBetweenPoints( p1:Object, p2:Object ) : Object {
				
			var dz:Number = p1.z - p2.z;
			var dy:Number = p1.y - p2.y;
			var dx:Number = p1.x - p2.x;
			
			var dist:Number = Math.sqrt(dx*dx+dy*dy+dz*dz);
			var rtd:Number = RAD_TO_DEG;
				
			var angZ:Number = Math.asin(dz/dist) * rtd;
			var angY:Number = Math.asin(dy/dist) * rtd;
			var angX:Number = Math.asin(dx/dist) * rtd;
				
			return { angX: angX, angY: angY, angZ: angZ };
				
		}

	}
}